package docbookarchivemanager.commands;

/**
 *
 * @author Jakub Hrachovec
 */
public enum Command {

    HELP("-help", 0, 0, false, null, null, null, "Shows this help dialog."),
    CONVERT("-c", 1, 1, false, null, null, null, "Given DocBook XML will be converted to DocBook Archive."),
    ADD_STYLESHEETS("-s", 1, Integer.MAX_VALUE, false, new Command[]{Command.CONVERT}, null, null, "Following stylesheets will be added to DocBook Archive. Use -fo after a stylesheet to select it as a FO stylesheet"),
    MODE("-m", 0, 0, false, new Command[]{Command.CONVERT}, null, null, "Folder structure wil be preserved in DocBook Archive."),
    TRANSFORM("-t", 1, 1, false, null, null, new Command[]{Command.CONVERT}, "Given DocBook Archive or XML will be transformed."),
    FO("-fo", 0, 0, false, new Command[]{Command.TRANSFORM}, null, null, "Transformation will use Apache FOP."),
    PARAMS("-p", 1, Integer.MAX_VALUE, false, new Command[]{Command.TRANSFORM}, null, null, "Passes parameters to Saxon."),
    XSL("-xsl", 1, 1, false, new Command[]{Command.TRANSFORM}, null, null, "Transformation will use this XSL."),
    SAXON("-saxon9", 0, 0, false, new Command[]{Command.TRANSFORM}, null, null, "Saxon 9.5.1.3 HE will be used instead of Saxon 6.5.5."),
    NO_COPY("-nocopy", 0,0, false, new Command[]{Command.TRANSFORM}, null, null, "Disables copying of referenced files (images, audio, video) after non-FO transformation relative to output file."),
    OUTPUT("-o", 1, 1, false, null, new Command[]{Command.CONVERT, Command.TRANSFORM}, null, "Specifies location of output file.");

    private String command;
    private int minOccurs;
    private int maxOccurs;
    private boolean isRequired;
    private Command[] dependencies;
    private Command[] atleastOneDependancy;
    private Command[] exclusives;
    private String helpText;

    private Command(String command, int minOccurs, int maxOccurs, boolean isRequired, Command[] dependencies, Command[] atleastOneDependency, Command[] exclusives, String helpText) {
        if (maxOccurs < minOccurs) {
            throw new IllegalArgumentException("Max occurs of arguments of the command " + command + " have to be higher or equal than min occurs.");
        }
        this.command = command;
        this.minOccurs = minOccurs;
        this.maxOccurs = maxOccurs;
        this.isRequired = isRequired;
        this.dependencies = dependencies;
        this.atleastOneDependancy = atleastOneDependency;
        this.exclusives = exclusives;
        this.helpText = helpText;
    }

    /**
     * @return the command
     */
    public String getCommand() {
        return command;
    }

    /**
     * @param command the command to set
     */
    public void setCommand(String command) {
        this.command = command;
    }

    /**
     * @return the maxOccurs
     */
    public int getMaxOccurs() {
        return maxOccurs;
    }

    /**
     * @param maxOccurs the maxOccurs to set
     */
    public void setMaxOccurs(int maxOccurs) {
        this.maxOccurs = maxOccurs;
    }

    /**
     * @return the dependencies
     */
    public Command[] getDependencies() {
        return dependencies;
    }

    /**
     * @param dependencies the dependencies to set
     */
    public void setDependencies(Command[] dependencies) {
        this.dependencies = dependencies;
    }

    /**
     * @return the exclusives
     */
    public Command[] getExclusives() {
        return exclusives;
    }

    /**
     * @param exclusives the exclusives to set
     */
    public void setExclusives(Command[] exclusives) {
        this.exclusives = exclusives;
    }

    /**
     * @return the isRequired
     */
    public boolean isRequired() {
        return isRequired;
    }

    /**
     * @param isRequired the isRequired to set
     */
    public void setIsRequired(boolean isRequired) {
        this.isRequired = isRequired;
    }

    /**
     * @return the minOccurs
     */
    public int getMinOccurs() {
        return minOccurs;
    }

    /**
     * @param minOccurs the minOccurs to set
     */
    public void setMinOccurs(int minOccurs) {
        this.minOccurs = minOccurs;
    }

    /**
     * @return the helpText
     */
    public String getHelpText() {
        return helpText;
    }

    /**
     * @return the atleastOneDependancy
     */
    public Command[] getAtleastOneDependancy() {
        return atleastOneDependancy;
    }
}
